﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls="clr-namespace:Sentinel.Support.Wpf"
    mc:Ignorable="d"
    x:Class="Sentinel.Extractors.Gui.ExtractorsControl"
    Name="extractorsControl"
    d:DesignWidth="756.67" d:DesignHeight="250">

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="80" />
        </Grid.ColumnDefinitions>
        <ListView ItemsSource="{Binding Extractors.Extractors}"
                  Grid.Column="0"
                  Grid.Row="0"
                  Grid.RowSpan="4"
                  SelectedIndex="{Binding Extractors.SelectedIndex}">
            <ListView.View>
                <GridView AllowsColumnReorder="False">
                    <Controls:FixedWidthColumn Header="Enabled"
                                               FixedWidth="28">
                        <Controls:FixedWidthColumn.HeaderTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="True"
                                          IsEnabled="False"
                                          ToolTipService.ShowOnDisabled="True"
                                          ToolTip="Is the extractor enabled?" />
                            </DataTemplate>
                        </Controls:FixedWidthColumn.HeaderTemplate>
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding Enabled}" 
                                          Margin="2,3,0,3"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </Controls:FixedWidthColumn>
                    <GridViewColumn Header="Name"
                                    DisplayMemberBinding="{Binding Name}" />
                    <GridViewColumn Header="Field"
                                    DisplayMemberBinding="{Binding Field}" />
                    <GridViewColumn Header="Mode"
                                    DisplayMemberBinding="{Binding Mode}" />
                    <GridViewColumn Header="Description"
                                    DisplayMemberBinding="{Binding Description}" />
                </GridView>
            </ListView.View>
        </ListView>
        <Button Content="_Add"
                Grid.Row="0"
                Grid.Column="1"
                Command="{Binding Extractors.Add}"
                Margin="5,0,5,5" />
        <Button Content="_Edit"
                Command="{Binding Extractors.Edit}"
                Grid.Row="1"
                Grid.Column="1"
                Margin="5,0,5,5" />
        <Button Content="_Remove"
                Command="{Binding Extractors.Remove}"
                Grid.Row="2"
                Grid.Column="1"
                Margin="5,0,5,5" />
    </Grid>
</UserControl>